package com.serge.smartdacha.model;

import java.util.Map;

public abstract class Controller {

    public static final String OFF = "off";

    public static final String ON = "on";

    private String id;

    protected Controller(String id) {
        this.id = id;
    }

    public String getId() {
        return id;
    }

    abstract protected void init(Map<String, String> map);

    protected int getInt(String s, int def) {
        try {
            return Integer.parseInt(s);
        } catch (NumberFormatException e) {
            return def;
        }
    }
}
